Skip to content

Use pharmpy create_basic_pk_model() as default instead of templates#59

Merged
roninsightrx merged 3 commits intomainfrom
create-model-pharmpy-default
Apr 3, 2026
Merged

Use pharmpy create_basic_pk_model() as default instead of templates#59
roninsightrx merged 3 commits intomainfrom
create-model-pharmpy-default

Conversation

@roninsightrx
Copy link
Copy Markdown
Contributor

Summary

  • Switch create_model() to use pharmr::create_basic_pk_model() by default (use_template=FALSE) instead of reading from built-in NONMEM template files
  • Add parameter name mapping layer to handle pharmpy's naming conventions (e.g. V→VC, Q→QP1, V2→VP1) in set_iiv(), set_initial_estimates(), and find_pk_parameter()
  • Fix create_basic_pk_model() returning JSON instead of NONMEM code by converting to NONMEM format early in the pipeline
  • Update all affected tests across 10 test files to match new parameter naming

Test plan

  • All 1423 tests pass (1 pre-existing get_pharmpy_conf ordering failure unrelated to changes)
  • Verify create_model() produces valid NONMEM control streams for iv, oral, and multi-compartment models
  • Verify IIV with correlations works correctly for both template and non-template paths
  • Verify use_template=TRUE still works as before for backward compatibility

🤖 Generated with Claude Code

roninsightrx and others added 3 commits April 2, 2026 20:56
Switch create_model() to use pharmr::create_basic_pk_model() by default
(use_template=FALSE) instead of reading from built-in NONMEM template files.
This fixes the issue where create_basic_pk_model() returned JSON instead of
NONMEM code by converting to NONMEM format early in the pipeline.

Key changes:
- Add use_template parameter (default FALSE) to create_model()
- Convert generic pharmpy model to NONMEM format immediately after creation
- Add parameter name mapping (V→VC, V1→VC, V2→VP1, Q→QP1, CL→CLMM) in
  set_iiv(), set_initial_estimates(), and find_pk_parameter()
- Fix blank line handling in create_pharmpy_model_from_list()
- Update all affected tests to use new parameter naming conventions
- Tests requiring ADVAN-specific features use use_template=TRUE explicitly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI doesn't have devtools installed — tests are loaded automatically
by testthat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roninsightrx roninsightrx merged commit 464dbfa into main Apr 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant